Subject grounding is one of the most important part of the circuit which helps in reducing the interference noise to a great extent. Actively driven ground has been used in our system design, wherein the common mode signal is taken from the inverting terminal of the filters and given to the inverting amplifier. The gain of the inverting amplifier is set by the formula, Gain = -Rf/R1. In our system, the gain of the inverting amplifier is approximately -6. Actively driven ground is widely used to eliminate the common mode interference signal, for example, the common 60Hz signal on both the signals of the differential signal. The output of the actively driven ground circuit is fed back to the body (in our case, arm) via a contact gel electrode [5], [6].
The electrodes had to be tested on the subject. Some parts of the arm were rather insensitive to finger movements, while some picked up finger EMG’s from most fingers. It was also found through trial and error that the other differential electrode has to be placed at a minimal distance from the electrode on the muscle to get a relevant signal. We initially had thought about using two sets of differential capacitive electrodes, but found there was cross talk . It was outside of our budget to make the electrodes with PCB or wireless, so we ended up having rather clunky electrodes with long leads hooked up to the post processing circuit. When we tested them together we found that the signals were coupled, so ended up removing one of them. We also found an interesting effect. If the dielectric constant of the insulators varied there was substantial noise. We had to make sure all four electrode insulation layers matched. Also, our circuit required the use of a contact electrode to alleviate the noise. The best way of testing the electrodes to make sure they were functional was just to tap them and check for a signal.
Figure 6: Capacitive EMG electrode placement and testing
2. Post Filtering circuit testing :
The filters of the post processing circuit were required to be tested. A sinusoidal signal of 20 mV was given from the function generator to the filter and the frequency was swept from 0 Hz to 1000 Hz. The amplitude started increasing from about 5 Hz and remained stable and constant until 200 Hz and started decreasing and completely attenuated at 600 Hz, showing the proper functioning of the analog filter. 60 Hz signal could be seen superimposed on the desired signal, but we chose not to have an analog notch filter, and chose to filter out the 60 Hz using digital filter. We did not connect the actively driven ground yet. Reading a few research papers on non contact electrodes, we realized the importance of an actively driven ground [5],[6]. Thus, we connected all the inverting terminals from the filters of all electrodes to an inverting amplifier. The inverting amplifier inverts the signal and feeds back to the body via gel contact electrode. The negative feedback drives the common mode voltage to a low voltage. Having connected the actively driven ground, we saw a significant reduction in the noise level. After testing on the breadboard, we chose to move on to the solder board, being the cheapest option if compared to the printed circuit boards.
To significantly be able to differentiate the signals from every finger, we chose to have multiple EMG electrodes. As the biopotential signals are best understood as differential signal, we chose to give the Nidaq differential input. Initially, we made one common negative input to the Nidaq, and had 3 positive input. This configuration was not suitable as we found two signals tracking each other. So, we chose to have two differential negative inputs with their two respective positive inputs. We had to compromise on the number of signals, as now we just had 2 signals as compared to 3 initially. We could get decent signals on the MATLAB GUI now, with two signals significantly changing with every finger moving. We encountered an unexpected issue with this configuration. Even if one electrode was disconnected from the arm, tapping it would significantly change the output of the other connected electrode. It meant all the four electrodes were coupled to it each other, and any movement of one would show a change in the output of the other. The reason of such coupling was not very clear, but one of the reason was the long wires connecting all across the circuit from sensors to the board, and to the Nidaq. We eventually chose to work with single differential signal, i.e. with two electrodes only being one positive and second negative.
SOFTWARE DESIGN
There are two MATLAB programs. The first program (signals.m) basically displays the EMG on a GUI. The second program displays a hand on a GUI which can be controlled by different finger motions. Both programs are similar in the setup of the Nidaq. Each program starts by setting up the nidaq for data acquisition. The command delete(daqfind) is used to remove any existing device objects in the workspace. Then, ‘nidaq’ is defined as the input, and an analog input object is created and assigned one channel input. The analog input is then configured to trigger manually, with the sampling frequency set to 1000 samples per second and samples per trigger set to 1000. The input type is also set to differential mode:
delete(daqfind);
adaptor='nidaq';
adaptorData = daqhwinfo(adaptor);
id = adaptorData.InstalledBoardIds{1} ;
ai = analoginput(adaptor, id);
set(ai,'InputType','Differential');
ch0 = addchannel(ai, 0); %differential input 1
Fs=1000; %sampling frequency
set(ai, 'SampleRate', Fs);
set(ai, 'SamplesPerTrigger', 1000);
set(ai, 'TriggerRepeat', 1);
set(ai, 'TriggerType', 'manual'); %trigger mode
In Signals.m, after setting up the Nidaq, the GUI is designed. A quit button was added to exit the program, and a capture button was added to be used to acquire data for each finger motion to train a neural network. A notch filter was designed using the signal processing toolbox:
function Hd = notch
Fs = 1000; % Sampling Frequency
N = 20; % Order
Fc1 = 55; % First Cutoff Frequency
Fc2 = 65; % Second Cutoff Frequency
% Construct an FDESIGN object and call its BUTTER method.
h = fdesign.bandstop('N,F3dB1,F3dB2', N, Fc1, Fc2, Fs);
Hd = design(h, 'butter');
end
This was done by designing a 20-order bandstop filter with stopband from 55 Hz to 65 Hz. Next a low pass butterworth filter with order 7 was designed. The cutoff frequency was set to 80 Hz. It could be as high as 300 Hz but we decided to limit the frequency to 80 Hz because there was some high frequency noise observed in the testing we decided would corrupt the classification. A high pass filter was designed with cutoff frequency of 10 Hz. The program keeps running until the quit button is hit. The program keeps reading the data from the Nidaq at a sampling frequency of 1000 Hz. The data is read using the following code:
start(ai); %start the analog input object
trigger(ai); %trigger the ai
[data,time]= getdata(ai, ai.SamplesPerTrigger);%read the nidaq
stop(ai);
The last 400 ms of the previous 1 second buffer is appended to the current buffer before filtering in order to get rid of transients and make the display more fluid. The data is first passed through a notch filter to get rid of the 60 Hz noise. Then it is passed through a low pass filter and high pass filter to restrict the signal to the EMG range that we want (10-80 Hz). Next the data is displayed on the GUI by setting the xdata and ydata of the current plot: “set(ch0plot,'xdata',time,'ydata', ch0data);”. The ‘drawnow’ command is used to ensure that the plot happens immediately so it looks real time. The program keeps running until the quit button is hit.
In ‘Processing.m’, the data is processed the same way as in ‘Signals.m’ except this time, we try to classify the signals and match it to a particular finger. The GUI in this case is a picture of a right hand with five pushbuttons which change color depending on which finger is perceived to have moved. The hand is displayed on the GUI by using the ‘imshow’ function on the hand.png picture which is in the same folder as the program. The window is then resized, and the pushbuttons are added. The classification is done using a probabilistic neural network (pnn) designed in Matlab. According to the Matlab help page, the pnn is a kind of radial basis network which has two layers. The first layer has biases which are set by the function ‘0.8326/spread’. We experimented with different values of the spread but none of them worked. The pnn requires a training set data which are the files that were recorded for each finger. There were five signals for each finger except the ring finger. We didn’t record signals for the ring finger because it was extremely difficult to move it without moving other fingers. Thus there were 20 training set vectors which form the 20 columns of the training matrix. A 4x20 target matrix is created. Each column is a particular column of the 4x4 identity matrix. Each column also corresponds to a particular column in the training set matrix. Each column has a 1 in the row which corresponds to the finger the training set vector corresponds to (1st row- thumb, 2nd row- index finger, 3rd row- middle finger, 4th row- little finger). The neural network is created using the code: “net = newpnn(P,T,spread);” where P is the training set matrix, T is the target matrix and ‘spread’ is the spread as described above. When each signal is sampled and processed, it is then passed through this neural network using the code: “y= sim(net, ch0data);”. The result is a vector with a 1 in the row the signal was classified as belonging to and a 0 elsewhere. The program checks to see if the signal in the buffer could be a real signal (its maximum should be greater than 8 mV and its minimum less than -2mV. If so, a flag is set depending on which finger was deduced to have been moved. The pushbutton above that finger changes color for two seconds. This program keeps running until the quit button is hit to exit.
SOFTWARE TESTING
For software testing, we plotted the signal in frequency domain with no hand motion to see which frequency bands the noise came from. As expected, there was a significant 60 Hz component. What was surprising is that, there was a lot of noise around 80 Hz, 200 Hz and 320 Hz. We weren’t sure where these noise signals came from but what was interesting was that each frequency from 80 Hz differed from the next by about 120 Hz. We designed notch filters to get rid of these frequencies. The 60 Hz noise was sufficiently attenuated. However, the other frequencies kept changing location (even though they differed by 120 Hz). After changing the bandwidth of the stop band for different notch filters, and not being able to get rid of these noise signals, we decided to limit the EMG signal to a band from 10-80 Hz. The high pass cutoff was set to 10 Hz to limit the interference that could arise from ECG signals.
The next test that was performed was the GUI that displays the hand. A test was made to make sure that the push buttons change color when a finger move is detected and that the right push button changes color. The next tests that were performed have to do with the process of obtaining signals for training the neural network. A program was written to obtain five training set signals for each finger apart from the ring finger of the test subject. The program detected when the signal crossed a certain threshold after the ‘capture’ button on the GUI had been pressed. The final test that was performed was changing the bias of the second layer of the probabilistic neural network designed in MATLAB. This was done by changing the ‘spread’ argument in the call “net = newpnn(P,T,spread);” This function is explained more in the documentation section.
RESULTS
We were successful in getting noise free EMG for every finger. We could see the change in amplitude significantly with the application of force on the complete arm. We saw consistency in the output of EMG for thumb and the little finger (pinky).
Figure 7: EMG signal from the little finger (pinky)
Figure 8: EMG signal from the little finger (pinky)
In Figure 7 and 8, we can see the change in amplitude, i.e. the rise in amplitude or spike, is the response to the movement of the little finger.
A picture of the GUI in normal operation is shown below:
The algorithm for detecting which finger moved didn’t work so well. A picture of the GUI is shown below:
Figure 9: MATLAB GUI
CONCLUSION
We were able to get very good EMG signals for every finger. The amplitude changed significantly with every movement of the finger. As we worked with only two electrodes as one differential channel, we were not able to differentiate between every finger effectively. We were not very successful with the neural network due to lack of multiple electrode. Overall, the EMG waveform was noise free and with more electrodes, we would surely be able to differentiate between every finger.
IEEE CODE OF ETHICS
We accept responsibility in making decisions consistent with the safety, health, and welfare of the public, and to disclose promptly factors that might endanger the public or the environment by performing experiments safely, and when in doubt consult the TA or Prof. Bruce. As my device is low powered, there are no issues pertaining to experimenting with high voltage. We had no real or perceived conflicts of interest and worked in harmony. We have been honest and realistic in stating claims or estimate based on available data, and have shown results as per the experimentation. We am not involved in bribery in all its forms. Over past couple of weeks, We have been constantly trying to improve the understanding of technology; it's appropriate application, and potential consequences by studying various research papers, asking for TA or Prof. Bruce for help and other fellow students. We readily seeked criticism from the TA or Prof. Bruce for any technical incompetence and worked over it to rectify error and mistakes. We was un biased with respect to race, religion, gender, disability, age, or national origin. I did not cause any injury to a person, or loss to the property or employment by false or malicious action.
APPENDIX A: Code
APPENDIX B: Schematic can be found in the hardware section
APPENDIX C: Parts List
Part |
Cost ($) |
INA 116 (*2) |
$10 each |
Solder Board (*2) |
Free (From the lab) |
Double sided copper clad |
$5 |
TLC27L2 (*3) |
Free (From the lab) |
NIDAQ |
Free (From the lab) |
Wires (Connectors) |
Free (From Lab) |
Resistors and Capacitors |
Free (From Lab) |
Total |
$25 |
APPENDIX D: Division of Labour
Parin Dedhia - Hardware circuit designing, web page
Nini Munoz - Sensor circuit designing
Roland Krieger - Software programming for MATLAB
Appendix E: References
We are really thankful to Prof. Bruce Land and Akshay Dhawan (Our TA) for their help for the final design project.
Datasheet:
1. INA 116:
http://www.ti.com/lit/ds/symlink/ina116.pdf
2. TLC27L2:
http://www.ti.com/lit/ds/symlink/tlc27l2m.pdf
Vendors:
1. Texas Instruments:
http://www.ti.com/
Online references:
1. E. Huigen, Noise in biopotential recording using surface electrodes. University of Amsterdam Section Medical Physics.
2. Heloyse Uliam Kuriki, Fabio Micolis de Azevedo, Luciana Sanae Ota Takahashi, Emanuelle Moraes Mello, Ruben de Faria Negra, Filho and Neri Alves (2012). The Relationship Between Electromyography and Muscle Force, EMG Methods for Evaluating Muscle and Nerve Function, Mr. Mark Schwartz (Ed.), ISBN: 978-953-307-793-2, InTech,
Available from:
http://www.intechopen.com/books/emg-methods-for-evaluating-muscle-and-nerve-function/the-relationship-between-electromyography-and-muscle-force
3. Day, Scott, “Important Factors in Surface EMG Measurement, Bortec biomedical
http://www.bortec.ca/Images/pdf/EMG%20measurement%20and%20recording.pdf.
4. Ferris, C.D. (1972). Introduction to bioelectrodes. Plenum Press, New York.
5. Taheri, B.A., Knight, R.T. and Smith, R.L. (1994). A dry electrode for EEG recording. Electroenceph. Clin. Neurophysiol., 90, 376-383.
6. Yu M. Chi and Gert Cauwenberghs, Wireless Non-contact EEG/ECG Electrodes for Body Sensor Networks. University of California, San Diego:
http://www.isn.ucsd.edu/pubs/bsn10.pdf
7. Gert Cauwenberghs et al., Wireless Non-contact Cardiac and Neural Monitoring. University of California, San Diego:
http://www.isn.ucsd.edu/pubs/wh2010.pdf.